const sqlite3 = require('sqlite3').verbose()
// 数据库名
const dbName = 'v3-exp.sqlite'
// 会自动创建数据库，位置在express项目根目录下
const db = new sqlite3.Database(dbName)
const ModsPack = require('./tb/ModsPack')
const ModsPackAttach = require('./tb/ModsPackAttach')

db.serialize(() => {
	db.run(ModsPack.create_sql)
	db.run(ModsPackAttach.create_sql)
})

ModsPack.db = db
ModsPackAttach.db = db

module.exports = db
module.exports.ModsPack = ModsPack
module.exports.ModsPackAttach = ModsPackAttach
